<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
	<%
	 String input=request.getParameter("validatecode");
	 String name=request.getParameter("username");
	 String password=request.getParameter("password");
    String code=(String)session.getAttribute("randomCode");       
    if(input.equals(code)&&!input.equals("")){ 
    	
    	if(name.equals("admin")&&password.equals("123")){
    		session.setAttribute("username", name);
    		session.setAttribute("password", password);
    		response.sendRedirect("Main.jsp");
    	}
    	else{
    		
    		out.println("<script>alert('用户名或密码不能为空！！');</script>");   
    		out.println("<script>window.location.href='Login.jsp'</script>");
    		return; 
    	} 
    }else{   
        out.println("<script>alert('验证码不能为空或验证码错误！！');</script>"); 
        out.println("<script>window.location.href='Login.jsp'</script>");
		return; 
    }   
	%>

</body>
</html>